//
//  ConditionalBootcamp.swift
//  FCSwiftUI
//
//  Created by 冯宣超 on 2023/2/22.
//

import SwiftUI

struct ConditionalBootcamp: View {
    
    @State var showCircle: Bool = false
    @State var showRectangle: Bool = false
    @State var isLoading: Bool = false

    var body: some View {
//        VStack {
//            Button("点击下载: \(isLoading.description)") {
//                isLoading.toggle()
//            }
//
//            if isLoading {
//                ProgressView()
//                    .scaleEffect(x: 3, y: 3, anchor: .center)
//                    .padding(.vertical, 30)
//            }
//        }
        
        
        VStack(spacing: 20) {
            Button("Circle Button: \(showCircle.description)") {
                showCircle.toggle()
            }

            Button("Rectangle Button: \(showRectangle.description)") {
                showRectangle.toggle()
            }
            
            if showCircle {
                Circle()
                    .frame(width: 100)
            } else if showRectangle {
                Rectangle()
                    .frame(width: 100, height: 100)
            }
            
            if !(showCircle || showRectangle) {
                RoundedRectangle(cornerRadius: 25.0)
                    .frame(width: 200, height: 100)
            }
        }
    }
}

struct ConditionalBootcamp_Previews: PreviewProvider {
    static var previews: some View {
        ConditionalBootcamp()
    }
}
